package punctuatedEquilibrium;

public class ArrayComparator {

	private static Trait[]	arrayOne;
	private static Trait[]	arrayTwo;

	public static boolean arraysEquivalent(Trait[] expected, Trait[] actual) {
		arrayOne = expected;
		arrayTwo = actual;
		if (sizeDoesntMatch()) {
			return false;
		} else {
			return (arrayItemsMatch());
		}
	}

	private static boolean arrayItemsMatch() {
		boolean noMismatch = true;
		int arraySize = arrayOne.length;
		for (int i = 0; i < arraySize; i++) {
			noMismatch = arrayOne[i].isEquivalent(arrayTwo[i]);
		}
		return noMismatch;
	}

	private static boolean sizeDoesntMatch() {
		int sizeOne = arrayOne.length;
		int sizeTwo = arrayTwo.length;
		return sizeOne != sizeTwo;
	}

}
